﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using QuanLyNhaSach.QuanLyNhaSachDTO;
namespace QuanLyNhaSach.QuanLyNhaSachDao
{
    class BaoCaoCongNoDao
    {
        public static void Insert(BaoCaoCongNoDTO bc)
        {
            bool active = true;
            string sql = "insert into BaoCaoCongNo(MaKhachHang,NgayPhatSinh,NoDau,PhatSinh,NoCuoi,Active) values(" + bc.MaKhachHang + ",'" + bc.NgayPhatSinh + "'," + bc.NoDau + ",'" + bc.PhatSinh + "'," + bc.NoCuoi + "," + active + ")";
            Database.ExcuNonQuery(sql);
        }
        public static DataTable BaoCaoThang(int thang)
        {
            string sql = "select MaKhachHang,NoDau,PhatSinh,NoCuoi from BaoCaoCongNo where Month(NgayPhatSinh) = '" + thang + "'";
            return Database.ExcuQuery(sql);
        }
        public static string MaSach(int thang)
        {
            DataTable dt;
            string sql = "select MaKhachHang from BaoCaoCongNo where Month(NgayPhatSinh) = '" + thang + "'";
            dt = Database.ExcuQuery(sql);
            string a = dt.Rows[0]["MaKhachHang"].ToString();
            return a;
        } 
    }
}
